package com.artwork.service.impl;

import com.artwork.mapper.UserMapper;
import com.artwork.model.User;
import com.artwork.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author JoJo
 * @Data 2021/9/8$ 13:48$
 * @Description
 * @Param $
 * @Return $
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> getList() {
        return userMapper.getList();
    }

    @Override
    public int addUser(User user) {
        return userMapper.insertSelective(user);
    }

    @Override
    public User getUserById(int id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public List<User> getSonUser(int id) {
        return userMapper.getSonUser(id);
    }

    @Override
    public User getUserByCode(String code) {
        return userMapper.getUserByCode(code);
    }

    @Override
    public User getUserByPhone(String phone) {
        return userMapper.getUserByPhone(phone);
    }


}
